from and_gate import AND
from nand_gate import NAND
from or_gate import OR


# 与非门
def XOR(x1, x2):
    s1 = NAND(x1, x2)
    s2 = OR(x1, x2)

    y = AND(s1, s2)
    if y <= 0:
        return 0
    else:
        return 1


# 主入口
if __name__ == '__main__':
    for xs in [(0, 0), (0, 1), (1, 0), (1, 1)]:
        y = XOR(xs[0], xs[1])
        print(str(xs) + ' -> ' + str(y))  # 这里不应该写常量，也不应该把东西写死，所以应该用变量来接收异或门电路的结果
